package org.wyf.EveryPoint.crowd.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.wyf.EveryPoint.crowd.entity.Project;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;
import java.util.Map;

/**
 * 项目表 Mapper
 *
 * @author wyf
 * @date 2021-04-09 16:56:53
 */
public interface ProjectMapper extends BaseMapper<Project> {

    List<Project> getBanner();

    Long creatProject(@Param("project") Project project);

    List<Map> countProjectOfType();

    @Select("select * from t_project where state in(3,5) order by hit_times desc limit 0,9 ")
    List<Project> getIndexShow();

    Page<Project> getFinishProjectList(Page<Project> page, @Param("keyWord") String keyWord, @Param("sortType") String sortType);

    Page<Project> getProjectList(Page<Project> page, @Param("keyWord") String keyWord, @Param("sortType") String sortType);

    Project selectProjectByOrderId(@Param("orderid") String orderid);

    @Select("select * from t_project where project_Id in (select pid from t_collection_project where uid = #{userId}) ")
    Page<Project> getCollectionProjectList(Page<Project> page, @Param("userId") Long userId);

    @Select("select * from t_project where uid = #{userId} order by create_time desc")
    List<Project> getUserAllprojectByUid(@Param("userId") Long userId);

    @Select("select * from t_project where uid = #{userId} and state = #{state}")
    List<Project> getUserProjectByState(@Param("userId") Long userId, @Param("state") Integer state);

    Page<Project> findProjects(Page<Project> page, @Param("project") Project project,@Param("list") List<Long> ids);
}
